package cn.hr.entity;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;


/**
 * 班级实体类
 */
@Entity
@Table(name="tb_classinfo"
    ,catalog="hrm"
)

public class ClassInfo  implements java.io.Serializable {


    // Fields    

     /**
	 * 
	 */
	private static final long serialVersionUID = 1799199168946793904L;
	private Integer id;
     private Specialty specialty;
     private String className;
     private Set<Student> students = new HashSet<Student>(0);


    // Constructors

    /** default constructor */
    public ClassInfo() {
    }

	/** minimal constructor */
    public ClassInfo(Specialty specialty, String className) {
        this.specialty = specialty;
        this.className = className;
    }
    
    /** full constructor */
    public ClassInfo(Specialty specialty, String className, Set<Student> students) {
        this.specialty = specialty;
        this.className = className;
        this.students = students;
    }

   
    // Property accessors
    @Id @GeneratedValue(strategy=IDENTITY)
    
    @Column(name="id", unique=true, nullable=false)

    public Integer getId() {
        return this.id;
    }
    
    public void setId(Integer id) {
        this.id = id;
    }
	@ManyToOne(fetch=FetchType.LAZY)
        @JoinColumn(name="specialtyId", nullable=false)

    public Specialty getSpecialty() {
        return this.specialty;
    }
    
    public void setSpecialty(Specialty specialty) {
        this.specialty = specialty;
    }
    
    @Column(name="className", nullable=false, length=32)

    public String getClassName() {
        return this.className;
    }
    
    public void setClassName(String className) {
        this.className = className;
    }
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="classInfo")

    public Set<Student> getStudents() {
        return this.students;
    }
    
    public void setStudents(Set<Student> students) {
        this.students = students;
    }
   








}